<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>canvas</title>
  <style>
    canvas {
      box-shadow: 5px 5px 10px #CCC;
    }
  </style>
</head>

<body>
  <canvas id="canvas" width="500" height="500">
    你的浏览器太low了~
  </canvas>
  <script>

    window.onload = function () {
      // ctx.arc(x, y, r, startAngle, endAngle, 是否逆时针)
      // startAngle默认从三点钟方向开始
      // 逆时针默认false
      var canvas = document.getElementById('canvas')
      if (canvas.getContext) {
        var ctx = canvas.getContext('2d');
        ctx.lineWidth = 3;

        ctx.arc(80, 80, 30, 1.5 * Math.PI, Math.PI);
        ctx.stroke()


        ctx.moveTo(350, 250)

        // 绘制一个笑脸-开始
        ctx.arc(250, 250, 100, 0, 2 * Math.PI);
        ctx.moveTo(310, 250)
        ctx.arc(250, 250, 60, 0, Math.PI);
        ctx.moveTo(222, 212)
        ctx.arc(212, 212, 10, 0, Math.PI * 2);
        ctx.moveTo(298, 212)
        ctx.arc(288, 212, 10, 0, Math.PI * 2);
        ctx.stroke()
        // 绘制一个笑脸-结束


      } else {
        alert('你的浏览器太low了~')
      }
    }
  </script>

</body>

</html>